from flask import Flask
from geventwebsocket.handler import WebSocketHandler
from gevent.pywsgi import WSGIServer

from models import db
from views import init_views

app = Flask(__name__)
app.config.from_object("config.DebugConfig")

init_views(app)
db.init_app(app)

if __name__ == '__main__':
    http_server = WSGIServer((app.config["HOST"], app.config["PORT"]), app, handler_class=WebSocketHandler)
    http_server.serve_forever()
